<template>
	<view class="box">
		<uNavbar title="兑换记录" bgColor="#211E38"></uNavbar>
		<view class="wrap" @click="sb()">
			排序
		</view>

		
	</view>

</template>

<script>
	import {
	
	} from "../../api/wallet.js"
	export default {
		data() {
			return {
				 products :[
				    { id: 1, name: 'Product A', price: 20 },
				    { id: 2, name: 'Product B', price: 35 },
				    { id: 3, name: 'Product C', price: 15 },
				    { id: 4, name: 'Product D', price: 40 },
				    { id: 5, name: 'Product E', price: 25 }
				]
			}
		},
		onLoad() {
		
		},
		onShow() {
		

		},
		methods: {
			leftClick() {
				//获取页面栈的长度
				const canNavBack = getCurrentPages()
				console.log(canNavBack.length);
				// 判断是否刷新了浏览器，刷新了浏览器，页面栈只有当前一个
				if (canNavBack.length > 1) {
					uni.navigateBack({
						delta: 1
					})
				} else {
					uni.switchTab({
						url: '/pages/index/index'
					})
				}
			},
			sb(){
				let sortedProducts =this.products.slice().sort((a, b) => a.price - b.price);
				console.log(sortedProducts)
			}
		}
	}
</script>

<style lang="scss" scoped>
	@font-face {
		font-family: 'iconfont';
		src: url("~@/iconfont/almm.ttf");
	}

	.box {
		width: 750rpx;
		height: 100vh;
		background-color: #211E38;
	}


	/deep/ .u-navbar__content__right__text {
		color: #FFFFFF;
	}
	.wrap{
		width: 690rpx;
		height: 438rpx;
		background: #3C2F65;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		margin: 0 auto;
		margin-top: 20rpx;
	}
</style>